home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of second order neuron
-
- #include "NSDLL.h"
-
- /* Backpropagation of component */
-
- __declspec(dllexport) void performBackAxon(
- DLLData *instance, // Pointer to instance data
- DLLData *dualInstance, // Pointer to the forward axons instance data
- NSFloat *data, // Pointer to the layer of processing elements (PEs)
- int rows, // Number of rows of PEs in the layer
- int cols, // Number of columns of PEs in the layer
- NSFloat *error // Pointer to the sensitivity vector
- )
- {
- int i, length=rows*cols;
- NSFloat lastX=1.0f, currentX=data[0], runningX;
-
- for (i=1; i<length; i++) {
- runningX = data[i]/currentX;
- error[i] = error[i]*lastX + error[i+1]*runningX;
- lastX = currentX;
- currentX = runningX;
- }
- }
-